package com.robot.io;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;

public class ReadFile {
	
	static final int numberArgForEdge = 4;
	
	String fileName;

	public ReadFile (String fileName){
		this.fileName=fileName;
	}	

	public Vector<List<String>> returnVectorFormofGraph(){
		BufferedReader br;
		Vector<List<String>> graphAsAVector = new Vector<List<String>>();
		
		try {
			br = new BufferedReader(new FileReader(this.fileName));

			String line;

			//for each line
			while((line = br.readLine()) != null) {
				StringTokenizer st = new StringTokenizer(line, ",");
				
				List<String> valueForOneEdge = new ArrayList<String>(numberArgForEdge);
				//for each token in the line
				while (st.hasMoreElements()) {
					valueForOneEdge.add((String)st.nextElement());
				}
				graphAsAVector.add(valueForOneEdge);
			}
			br.close();
			

			
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		return graphAsAVector;
	}
}